//	0xAN mean this point are replaced by N bytes received
//0xAF - 15 bytes,  0xA4 - 4 bytes, 0xA5 - 5 bytes, etc

//	0xBN mean this point are replaced by respN[]
//0xB1 - resp1[], 0xB2 - resp2[], 0xB4 - resp4[]

//	0xDA mean this point are replaced by digital pair of (0x0D,0x0A),0x0D first,0x0A second
#include "ate.h"
#include "idefs.h"

const uint8_t resp1[]={0xDA,'O','K'};
const uint8_t resp2[]={0xDA,0xDA,'O','K'};
const uint8_t resp4[]={0xDA,0xDA};

const uint8_t atry[]={'A','T',0x0D};

const uint8_t qcfg[]={'A','T','+','Q','C','F','G','=','"','U','R','C','/','D','i','s','a','b','l','e','"',',','1',0x0D};



const uint8_t cpinq[]={'A','T','+','C','P','I','N','?',0x0D};
const uint8_t cpinq_rdy[]={0x0D,0x0A,'+','C','P','I','N',':',' ','R','E','A','D','Y',0xB2};
const uint8_t cpinq_err[]={0x0D,0x0A,'+','C','M','E',' ','E','R','R','O','R',':'};

uint32_t at_cpinq_callback(uint32_t * ctx, uint32_t msg)
{
	return 0;
}



const uint8_t cimi[]={'A','T','+','C','I','M','I',0x0D};
const uint8_t cimi_back[]={0x0D,0x0A, 0xAF, 0xB2};
const uint8_t cimi_error[]={0x0D,0x0A,'E','R','R','O','R'};

uint32_t at_cimi_callback(uint32_t * ctx, uint32_t msg)
{
	return 0;
}



const uint8_t csq[]={'A','T','+','C','S','Q',0x0D};
const uint8_t csq_back[]={0x0D,0x0A,'+','C','S','Q',':', 0xA5, 0xB2};

uint32_t at_csq_callback(uint32_t * ctx, uint32_t msg)
{
	return 0;
}



const uint8_t cgregq[]={'A','T','+','C','R','E','G','?',';','+','C','G','R','E','G','?',0x0D};
const uint8_t cgregq_back[]={0x0D,0x0A,'+','C','R','E','G',':', 0xA4, 0xB4,'+','C','G','R','E','G',':',0xA4, 0xB2};

uint32_t at_cgregq_callback(uint32_t * ctx, uint32_t msg)
{
	return 0;
}



void register_at(void)
{
	reg_new_at(AT_AT, NULL);
	reg_at_meta(0,1,sizeof(atry),atry);
	reg_at_meta(1,NULL,sizeof(resp1),resp1);
	
	reg_new_at(AT_QCFG, NULL);
	reg_at_meta(0,1,sizeof(qcfg),qcfg);
	reg_at_meta(1,NULL,sizeof(resp1),resp1);
	
	reg_new_at(AT_CPINQ, at_cpinq_callback);
	reg_at_meta(0,2,sizeof(cpinq),cpinq);
	reg_at_meta(1,NULL,sizeof(cpinq_rdy),cpinq_rdy);
	reg_at_meta(2,NULL,sizeof(cpinq_err),cpinq_err);
	
	reg_new_at(AT_CIMI, at_cimi_callback);
	reg_at_meta(0,2,sizeof(cimi),cimi);
	reg_at_meta(1,NULL,sizeof(cimi_back),cimi_back);
	reg_at_meta(2,NULL,sizeof(cimi_error),cimi_error);
	
	reg_new_at(AT_CSQ, at_csq_callback);
	reg_at_meta(0,1,sizeof(csq),csq);
	reg_at_meta(1,NULL,sizeof(csq_back),csq_back);
	
	reg_new_at(AT_CGREGQ, at_cgregq_callback);
	reg_at_meta(0,1,sizeof(cgregq),cgregq);
	reg_at_meta(1,NULL,sizeof(cgregq_back),cgregq_back);
}